package com.orhon.smartcampus.modules.material.mm;



import java.util.List;

import org.mapstruct.InheritConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import com.orhon.smartcampus.modules.base.mm.LangMapper;
import com.orhon.smartcampus.modules.base.mm.SchoolMapper;
import com.orhon.smartcampus.modules.material.entity.Room;
import com.orhon.smartcampus.modules.material.gqlModel.GQLRoom;

@Mapper(
		uses = {
				LangMapper.class,
				SchoolMapper.class,
				FloorMapper.class

		}
		)
public interface RoomMapper {


	RoomMapper MAPPER = Mappers.getMapper(RoomMapper.class);

	@Mapping(source = "id" , target = "id")
	@Mapping(source = "roomArea" , target = "area")
	@Mapping(source = "roomCode" , target = "code")
	@Mapping(source = "roomType" , target = "type", qualifiedByName = "str2dic")
	@Mapping(source = "keyNum" , target = "key_num")
	@Mapping(source = "roomStatus" , target = "status")
	@Mapping(source = "roomManager" , target = "manager")
	@Mapping(source = "keysUserName" , target = "keys_user_name")
	@Mapping(source = "name" , target = "name")
	@Mapping(source = "remarks" , target = "remarks")
	@Mapping(source = "createdAt" , target = "created_at")
	@Mapping(source = "updatedAt" , target = "updated_at")
	@Mapping(ignore = true, target = "floor" )
	@Mapping(ignore = true, target = "school" )
	GQLRoom toRoom(Room entity);

	@InheritConfiguration(name = "toRoom")
	List<GQLRoom> toRoomList(List<Room> entities);
}
